package com.lxl.commons.mapper.impl;



import com.lxl.commons.mapper.IMapper;
import com.lxl.workbench.entity.CommonStaff;
import javax.servlet.jsp.jstl.sql.Result;
import java.util.ArrayList;
import java.util.List;

/**
 * 普通员工的Result转化成List集合
 * @author 北上寻海
 */
public class CommonStaffMapperImpl implements IMapper {
    @Override
    public List<CommonStaff> mapper(Result result) {
        List<CommonStaff> list = new ArrayList<>();
        if(result.getRowCount()!=0){
            for (int i = 0 ;i<result.getRowCount();i++){
                CommonStaff staff = new CommonStaff();
                staff.setId((String)result.getRowsByIndex()[i][0]);
                staff.setStaffName((String)result.getRowsByIndex()[i][1]);
                staff.setGender((String)result.getRowsByIndex()[i][2]);
                staff.setPhone((String)result.getRowsByIndex()[i][3]);
                staff.setUserId((String)result.getRowsByIndex()[i][4]);
                staff.setPermissions((String)result.getRowsByIndex()[i][5]);
                list.add(staff);
            }
        }
        return list;
    }


}
